package com.kungfuhacking.wristbandpro.location.presenter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.kungfuhacking.wristbandpro.R;


/**
 * Created by Aaron on 15/8/4.
 */
public class SimpleAdapter extends BaseAdapter {

    private Context ctx;
    private String[] times;

    public SimpleAdapter(Context ctx, String[] times) {
        this.ctx = ctx;
        this.times = times;
    }

    @Override
    public int getCount() {
        return times.length;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;

        if (convertView == null) {

            convertView = View.inflate(ctx, R.layout.item_simple, null);
            viewHolder = new ViewHolder();
            viewHolder.tv_classify = (TextView) convertView.findViewById(R.id.tv_classify);
            convertView.setTag(viewHolder);

        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.tv_classify.setText(times[position]);

        return convertView;
    }

    private class ViewHolder {

        private TextView tv_classify;

    }
}
